package org.bees.cms.core.furnish;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import org.bees.cms.core.Describable;
import org.bees.cms.core.Domain;
import org.bees.cms.core.Named;

@MappedSuperclass
public abstract class Furnish extends Domain implements Named, Describable {
	private static final long serialVersionUID = -8630727668251189100L;

	protected String name;
	protected Kind kind;
	protected Integer cost;
	protected Integer market;
	protected Integer price;
	protected Unit unit;
	protected String description;
	protected String detail;

	@Column(length = 24, nullable = false)
	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH }, optional = false)
	public Kind getKind() {
		return kind;
	}

	public void setKind(Kind kind) {
		this.kind = kind;
	}

	public Integer getCost() {
		return cost;
	}

	public void setCost(Integer cost) {
		this.cost = cost;
	}

	public Integer getMarket() {
		return market;
	}

	public void setMarket(Integer market) {
		this.market = market;
	}

	public Integer getPrice() {
		return price;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH }, optional = false)
	public Unit getUnit() {
		return unit;
	}

	public void setUnit(Unit unit) {
		this.unit = unit;
	}

	@Column(length = 160)
	@Override
	public String getDescription() {
		return description;
	}

	@Override
	public void setDescription(String description) {
		this.description = description;
	}

	@Lob
	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

}
